<!DOCTYPE html>
<!--
To change this license header, choose License Headers in Project Properties.
To change this template file, choose Tools | Templates
and open the template in the editor.
-->
<html>
    <head>
        <meta charset="UTF-8">
        <title></title>
    </head>
    <body>

        <?php
        //import 文件
        require_once('/Users/CTR/desktop/Phpweb1/conn.php');

        $query = "SELECT id,name,sex,classnum,grade,major from mytable order by id";

        $result = @mysqli_query($conn, $query);

        if ($result) {
            echo '<table align="left" cellspacing="5" cellpading="8"> 
                    <td align="left" bgcolor=#00FFFF>id</td>
                    <td align="left" bgcolor=#00FFFF>name</td> 
                    <td align="left" bgcolor=#00FFFF>sex</td> 
                    <td align="left" bgcolor=#00FFFF>classnum</td> 
                    <td align="left" bgcolor=#00FFFF>grade</td> 
                    <td align="left" bgcolor=#00FFFF>major</td>
                    </tr>';

            while ($row = mysqli_fetch_array($result)) {
                echo '<tr>'
                . '<td align="left">' . $row[id] . '</td>'
                . '<td align="left">' . $row[name] . '</td>'
                . '<td align="left">' . $row[sex] . '</td>'
                . '<td align="left">' . $row[classnum] . '</td>'
                . '<td align="left">' . $row[grade] . '</td>'
                . '<td align="left">' . $row[major] . '</td>'
              . '<td align="left"><a href="update.php?id='.$row['id'].'">修改</a></td>'
              . '<td align="left"><a href="add.php?id='.$row['id'].'"> 增加</a></td>'
              . '<td align="left"><a href="delete.php?id='.$row['id'].'">删除</a></td>'
              . '<td align="left"><a href="search.php?id='.$row['id'].'">查询</a></td>'
                
                ;

                echo'</tr>';
            }
            echo "</table>";
        } else {

            echo"Failed query";
            echo mysqli_error($conn);
        }
        mysqli_close($conn);
      
        include('links.txt');
       
        ?>

    </body>
</html>
